package server;

import java.io.Serializable;

/**
 * <h1>Class Preferences</h1>
 * 
 * Stores the user's preferences.
 * 
 * @author Tomas
 * @date March 6 2009
 * @modified by Jim 3/13/09 created username getters,setters
 */
public class Preferences implements Serializable{

	/**
	 * Required by the Serializable interface.
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * Username to identify the preferences
	 */
	protected String username = "";

	/**
	 * Sorting criteria to display contacts.
	 * <ul>
	 * 		<li>Name: sort the contacts by name.</li>
	 * 		<li>Group: sort the contacts by group.</li>
	 * </ul>
	 * 
	 * @author Tomas
	 * @date March 8 2009
	 */
	public enum SortBy {NAME, GROUP};
	
	/**
	 * Different ways in which a new conversation window is created.
	 * <ul>
	 * 		<li>Individual: creates a new window when a conversation is started.</li>
	 * 		<li>Tabbed: creates a new tab when a conversation is started.</li>
	 * </ul> 
	 * 
	 * @author Tomas
	 * @date March 8 2009
	 */
	public enum ConversationWindow {INDIVIDUAL, TABBED};
	
	/**
	 * Time to set away mode (in seconds)
	 */
	protected long timeAwayMode = 0;
	
	/**
	 * Sound active/inactive
	 */
	protected boolean sound = true;
	
	/**
	 * Determines the sorting criteria to display the contacts.
	 */
	protected SortBy sortCriteria = SortBy.NAME;
	
	/**
	 * Determines if the buddies are displayed with an icon or not.
	 */
	protected boolean icon = true;
	
	/**
	 * Determines if the buddies are displayed grouped or not.
	 */
	protected boolean grouped = true;
	
	/**
	 * Determines if the offline contacts are displayed or not.
	 */
	protected boolean showOffline = true;
	
	/**
	 * Determines how a new conversation window is displayed.
	 */
	protected ConversationWindow convWindow = ConversationWindow.INDIVIDUAL;
	
	/**
	 * Default path to store the conversations.
	 */
	protected String defaultPath = "./";
	
	/**
	 * Number of days the conversations are stored.
	 */
	protected int historyDays = 0;
	
	// TODO: font, size and color
	
	/**
	 * Default constructor. Necessary for the Serializable interface.
	 * Left intentionally blank. 
	 */
	public Preferences(){
		
	}
	public String getUsername(){
		return username;
	}
	public void setUsername(String username){
		this.username = username;
	}

	public long getTimeAwayMode() {
		
		return timeAwayMode;
		
	}

	public void setTimeAwayMode(long timeAwayMode) {
		
		this.timeAwayMode = timeAwayMode;
		
	}

	public boolean isSoundActive() {
		
		return sound;
		
	}

	public void setSound(boolean sound) {
		
		this.sound = sound;
		
	}

	public SortBy getSortCriteria() {
		
		return sortCriteria;
		
	}

	public void setSortCriteria(SortBy sortCriteria) {
		
		this.sortCriteria = sortCriteria;
		
	}

	public boolean isIconActive() {
		
		return icon;
		
	}

	public void setIcon(boolean icon) {
		
		this.icon = icon;
		
	}

	public boolean isGrouped() {
		
		return grouped;
		
	}

	public void setGrouped(boolean grouped) {
		
		this.grouped = grouped;
		
	}

	public boolean isShowOffline() {
		
		return showOffline;
		
	}

	public void setShowOffline(boolean showOffline) {
		
		this.showOffline = showOffline;
		
	}

	public ConversationWindow getConvWindow() {
		
		return convWindow;
		
	}

	public void setConvWindow(ConversationWindow convWindow) {
		
		this.convWindow = convWindow;
		
	}

	public String getDefaultPath() {
		
		return defaultPath;
		
	}

	public void setDefaultPath(String defaultPath) {
		
		this.defaultPath = defaultPath;
		
	}

	public int getHistoryDays() {
		
		return historyDays;
		
	}

	public void setHistoryDays(int historyDays) {
		
		this.historyDays = historyDays;
		
	}
	
}
